// 输入[1,2,3,4,5,6,7], 3
// 输出[5,6,7,1,2,3,4]
function rotate2(arr1: number[],k: number){
    let arr2:number[] = [];
    // for( let i=0; i < arr1.length;i++ ){
    //     arr2[i] = 0;
    // }
    for(let i = k+1,j=0; i < arr1.length;i++,j++){
        arr2[j] = arr1[i];
    }
    console.log(arr2);
    for(let i = 0; i < arr1.length-k;i++){
        arr2.push( arr1[i] );
    }
    return arr2;

}
const arr1 = [1, 2, 3, 4, 5, 6, 7];
const arr2 = rotate2(arr1 ,3);
console.log(arr2);
